import { request } from "@/utils/http"
import { AddHospitalParams, GetHospitalSetListParams, GetHospitalSetListResponse, UpdateHospitalParams } from "./model/hospitalSetTypes"
import { Key } from "react";

//查询
export const reqGetHospitalSetList = ({ page, limit, hosname, hoscode }: GetHospitalSetListParams) => {
    return request.get<any, GetHospitalSetListResponse>(`/admin/hosp/hospitalSet/${page}/${limit}`, {
        params: {
            hosname,
            hoscode,
        },
    })
}

//批量删除
export const reqBatchRemoveHospitals = (idList: Key[]) => {
    return request.delete<any, null>(`/admin/hosp/hospitalSet/batchRemove`, {
        data: idList,
    });
};

// 删除医院
export const reqRemoveHospital = (id: number) => {
    return request.delete<any, null>(`/admin/hosp/hospitalSet/remove/${id}`);
};

//添加医院
export const reqAddHospital = (data: AddHospitalParams) => {
    return request.post<any, null>(`/admin/hosp/hospitalSet/save`, data);
};

// 修改医院
export const reqUpdateHospital = (data: UpdateHospitalParams) => {
    // data就是put请求的请求体参数
    return request.put<any, null>(`/admin/hosp/hospitalSet/update`, data);
};